package test;


//定义方法，计算从1到某个数以内所有能被3或者17整除的数的和。
public class SomeNumberCount {
    public static void main(String[] args) {
        int num = 6;
        int sum = threeAndSeventeenSum(num);
        System.out.println(sum);
    }

    private static int threeAndSeventeenSum(int num) {
        int sum = 0;
        for (int i = 1; i <= num; i++) {
            if(i % 3 == 0 || i % 17 ==0){
                sum += i;
            }
        }
        return sum;
    }
}
